<?php
    include_once("functions_bandwidth.php");
    include_once("functions_bandwidth_domain.php");
    include_once("datefunctions.php");
?>


<?php
if ($_GET['content'] == 1)
{
    print "<b>Overzicht vandaag</b><br />
        &nbsp;<br />
        
        <table style=\"border-collapse: collapse;border: 1px solid #000000;\">
            <tr>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\" width=\"200\"><font size='-1'><b>Naam</b></font></td>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\"><font size='-1'><b>Verbuik</b></font></td>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\"><font size='-1'><b># Gebruikers</b></font></td>
            </tr>";

    //Berekening datum 1ste tot laatste
    $Start = date("Y/m/d") . " 00:00:00";
    $Einde = date("Y/m/d") . " 23:59:59";
    $result = func_bw_volume_domain_all_periode($Start, $Einde);

    while ($row = mysql_fetch_array($result)){
        echo "<tr>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\"><font size='-1'><a onclick=\"getDetail('content_domein_detail.php?domein=" . $row['domein'] . "&periode=0')\">" . $row['domein'] . "</a></font></td>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\" align=\"right\"><font size='-1'>" . round(($row['size'] / 1024) / 1024, 1) . " MB</font></td>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\" align=\"right\"><font size='-1'>" . $row['aantdom'] . "</font></td>";
        echo "</tr>";
    }

    print "</table>";

}
if ($_GET['content'] == 2)
{
    print "<b>Overzicht gisteren</b><br />
        &nbsp;<br />
        <table style=\"border-collapse: collapse;border: 1px solid #000000;\">
            <tr>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\" width=\"200\"><font size='-1'><b>Naam</b></font></td>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\"><font size='-1'><b>Verbuik</b></font></td>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\"><font size='-1'><b># Gebruikers</b></font></td>
            </tr>";

    //Berekening datum 1ste tot laatste
    $Start = date("Y/m/d") . " 00:00:00";
    $Start = DateAdd("d", -1, $Start);
    $Start = date("Y/m/d", $Start) . ' 00:00:00' ;
    $Einde = date("Y/m/d") . " 23:59:59";
    $Einde = DateAdd("d", -1, $Einde);
    $Einde = date("Y/m/d", $Einde) . ' 23:59:59' ;
    $result = func_bw_volume_domain_all_periode($Start, $Einde);

    while ($row = mysql_fetch_array($result)){
        echo "<tr>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\"><font size='-1'><a onclick=\"getDetail('content_domein_detail.php?domein=" . $row['domein'] . "&periode=1')\">" . $row['domein'] . "</a></font></td>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\" align=\"right\"><font size='-1'>" . round(($row['size'] / 1024) / 1024, 1) . " MB</font></td>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\" align=\"right\"><font size='-1'>" . $row['aantdom'] . "</font></td>";
        echo "</tr>";
    }

    print "</table>";
}
if ($_GET['content'] == 3)
{
    print "<b>Overzicht laatste 7 dagen</b><br />
        &nbsp;<br />
        <table style=\"border-collapse: collapse;border: 1px solid #000000;\">
            <tr>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\" width=\"200\"><font size='-1'><b>Naam</b></font></td>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\"><font size='-1'><b>Verbuik</b></font></td>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\"><font size='-1'><b># Gebruikers</b></font></td>
            </tr>";

    //Berekening datum 1ste tot laatste
    $Einde = date("Y/m/d") . " 23:59:59";
    $Start = date("Y/m/d") . " 00:00:00";
    $Start = DateAdd("d", -6, $Start);
    $Start = date("Y/m/d", $Start) . ' 00:00:00' ;
    $result = func_bw_volume_domain_all_periode($Start, $Einde);

    while ($row = mysql_fetch_array($result)){
        echo "<tr>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\"><font size='-1'><a onclick=\"getDetail('content_domein_detail.php?domein=" . $row['domein'] . "&periode=2')\">" . $row['domein'] . "</a></font></td>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\" align=\"right\"><font size='-1'>" . round(($row['size'] / 1024) / 1024, 1)  . " MB</font></td>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\" align=\"right\"><font size='-1'>" . $row['aantdom'] . "</font></td>";
        echo "</tr>";
    }
    
    print "</table>";
}
if ($_GET['content'] == 4)
{
    print "<b>Overzicht deze maand</b><br />
        &nbsp;<br />
        <table style=\"border-collapse: collapse;border: 1px solid #000000;\">
            <tr>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\" width=\"200\"><font size='-1'><b>Naam</b></font></td>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\"><font size='-1'><b>Verbuik</b></font></td>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\"><font size='-1'><b># Gebruikers</b></font></td>
            </tr>";

    //Berekening datum 1ste tot laatste
    $Start = date("Y/m/") . "1 00:00:00";
    $Einde = date("Y/m/") . "1 00:00:00";
    $Einde = DateAdd("m", 1, $Einde);
    $Einde = date("Y/m/d", $Einde) . ' 23:59:59' ;
    $Einde = DateAdd("d", -1, $Einde);
    $Einde = date("Y/m/d", $Einde) . ' 23:59:59';
    $result = func_bw_volume_domain_all_periode($Start, $Einde);

    while ($row = mysql_fetch_array($result)){
        echo "<tr>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\"><font size='-1'><a onclick=\"getDetail('content_domein_detail.php?domein=" . $row['domein'] . "&periode=3')\">" . $row['domein'] . "</a></font></td>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\" align=\"right\"><font size='-1'>" . round(($row['size'] / 1024) / 1024, 1) . " MB</font></td>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\" align=\"right\"><font size='-1'>" . $row['aantdom'] . "</font></td>";
        echo "</tr>";
    }

    print "</table>";
}
if ($_GET['content'] == 5)
{
    print "<b>Overzicht deze maand</b><br />
        &nbsp;<br />
        <table style=\"border-collapse: collapse;border: 1px solid #000000;\">
            <tr>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\" width=\"200\"><font size='-1'><b>Naam</b></font></td>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\"><font size='-1'><b>Verbuik</b></font></td>
                <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\"><font size='-1'><b># Gebruikers</b></font></td>
            </tr>";

    //Berekening datum 1ste tot laatste
    $Start = date("Y/m/") . "1 00:00:00";
    $Start = DateAdd("m", -1, $Start);
    $Start = date("Y/m/d", $Start) . ' 00:00:00' ;
    $Einde = date("Y/m/") . "1 00:00:00";
    $Einde = DateAdd("d", -1, $Einde);
    $Einde = date("Y/m/d", $Einde) . ' 23:59:59';
    $result = func_bw_volume_domain_all_periode($Start, $Einde);

    while ($row = mysql_fetch_array($result)){
        echo "<tr>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\"><font size='-1'><a onclick=\"getDetail('content_domein_detail.php?domein=" . $row['domein'] . "&periode=4')\">" . $row['domein'] . "</a></font></td>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\" align=\"right\"><font size='-1'>" . round(($row['size'] / 1024) / 1024, 1) . " MB</font></td>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\" align=\"right\"><font size='-1'>" . $row['aantdom'] . "</font></td>";
        echo "</tr>";
    }

    print "</table>";
}

?>
